﻿using System;
using System.Globalization;
using System.Windows.Data;
using StockholmsStad.Runtime.Serialization.DataContract;

namespace StockholmsStad.Windows.UI.Infrastructure.Converters
{
    public class ValueIdPairToStringConverter : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is ValueIdPair)
            {
                var item = (ValueIdPair)value;
                return item.Name;
            }
            
            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotSupportedException();
        }

        #endregion
    }

}
